package com.tengju.motivation.domain.model.performance;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum PerformanceObjectiveStatusEnum {

    VALID(1, "有效"),
    INVALID(2, "无效"),
    ;
    private Integer code;
    private String desc;

    PerformanceObjectiveStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PerformanceObjectiveStatusEnum form(Integer code) {
        return Arrays.stream(PerformanceObjectiveStatusEnum.values())
                .filter(k -> k.getCode().equals(code))
                .findFirst().orElse(null);
    }
}
